package statemode.state;

import statemode.context.Zh0202User;

/**
 * @author: zh
 * @date: 2021/12/17 15:58
 * @version: 1.0
 */
public class Zh0202OrdinaryMember extends Zh0202Level {
    public Zh0202OrdinaryMember(Zh0202Level level) {
        this.score = level.score;
        this.user = level.user;
        System.out.println("您已经降至普通会员");
    }

    public Zh0202OrdinaryMember(Zh0202User user) {
        this.score = 0;
        this.user = user;
        System.out.println("恭喜你成功注册");
    }

    @Override
    public double calcRealAmount() {
        return 100;
    }

    @Override
    public double changeCredit() {
        return 0;
    }

    @Override
    public void checkLevel() {
        if (this.score>=100){
            user.setUserLevel(new Zh0202SilverMember(this));
            System.out.println("恭喜你成功升级为黄金会员");
        }
    }
}
